using UnityEngine;
using System.Collections;

public class StarToCollect : Trap {

    private bool _picked = false;
    public override void SetTrapType()
    {
        typeTrap = Const.TRAP_TYPE.BONUS;
        activated = true;
    }

    public override IEnumerator toggleTrap()
    {
        yield return new WaitForSeconds(0.1f);
    }

    public override void trapActivated(Collider _archelogist)
    {
        if (!_picked && _archelogist.gameObject.layer == Const.LAYER_PLAYER)
        {
                
            AudioSource.PlayClipAtPoint(clip[0], this.transform.position);
            PlayerManager.Instance.NbStar++;
            this.renderer.enabled = false;
        }   
    }

    void Update()
    {
        this.transform.Rotate(Vector3.up, 20.0f * Time.deltaTime);
    }
}
